import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DirectTransferOrderVO, DirectTransferOrderForm, DirectTransferOrderQuery } from '@/api/datacheck/jd/directTransferOrder/types';

/**
 * 查询金蝶-直接调拨单列表
 * @param query
 * @returns {*}
 */

export const listDirectTransferOrder = (query?: DirectTransferOrderQuery): AxiosPromise<DirectTransferOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/directTransferOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-直接调拨单详细
 * @param id
 */
export const getDirectTransferOrder = (id: string | number): AxiosPromise<DirectTransferOrderVO> => {
  return request({
    url: '/dataCheck/jd/directTransferOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增金蝶-直接调拨单
 * @param data
 */
export const addDirectTransferOrder = (data: DirectTransferOrderForm) => {
  return request({
    url: '/dataCheck/jd/directTransferOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改金蝶-直接调拨单
 * @param data
 */
export const updateDirectTransferOrder = (data: DirectTransferOrderForm) => {
  return request({
    url: '/dataCheck/jd/directTransferOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除金蝶-直接调拨单
 * @param id
 */
export const delDirectTransferOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dataCheck/jd/directTransferOrder/' + id,
    method: 'delete'
  });
};
